#!/bin/bash
if [ $# -lt 1 ]; then
    echo 1: beaglebone_defconfig
    echo 2: qemu_arm_vexpress_defconfig
    echo 3: raspberrypi2_defconfig
    echo 4: raspberrypi3_defconfig
    echo 5: imx6ulevk_defconfig
    echo 6: qemu_riscv64_virt_defconfig
    echo 7: orangepi_pc_defconfig
else
    if [ $1 == '1' ]; then
        defconfig=beaglebone_defconfig
        output=$PWD/output/beaglebone
        mkdir -p $output
    elif [ $1 == '2' ]; then
        output=$PWD/output/vexpress-a9
        defconfig=qemu_arm_vexpress_defconfig
        mkdir -p $output
    elif [ $1 == '3' ]; then
        output=$PWD/output/raspberrypi2
        defconfig=raspberrypi2_defconfig
        mkdir -p $output
    elif [ $1 == '4' ]; then
        output=$PWD/output/raspberrypi3
        defconfig=raspberrypi3_defconfig
        mkdir -p $output
    elif [ $1 == '5' ]; then
        output=$PWD/output/imx6ulevk
        defconfig=imx6ulevk_defconfig
        mkdir -p $output
    elif [ $1 == '6' ]; then
        output=$PWD/output/riscv64_virt
        defconfig=qemu_riscv64_virt_defconfig
        mkdir -p $output
    elif [ $1 == '7' ]; then
        output=$PWD/output/orangepi_pc
        defconfig=orangepi_pc_defconfig
        mkdir -p $output
    else
        echo 1: beaglebone_defconfig
        echo 2: qemu_arm_vexpress_defconfig
        echo 3: raspberrypi2_defconfig
        echo 4: raspberrypi3_defconfig
        echo 5: imx6ulevk_defconfig
    fi
    make O=$output $2 $3 $4 $5
fi
